Repository navigation
fix(providers): support Ollama Cloud execution contracts - #6601
Colafornia wants to merge 3 commits into
Conversation
2153dc8 to
73fe03f
Compare
0529093 to
798e78f
Compare
Carry compatible usage and reasoning replay policy through request and captured wire encoding. Keep Ollama Cloud models selectable and report preparation failures in settings. Generated-by: Codex
Remove the ChatPolicy parsing layer and reuse chat prompt options for request preparation. Revert the unrelated settings warning while retaining selection and wire contract regressions. Generated-by: Codex
Address accepted review feedback by preserving the default chat codec identity and testing includeUsage:false fact propagation. Clean up duplicate assertions and use independent reasoning wire expectations. Generated-by: Codex
798e78f to
945fbdc
Compare
There was a problem hiding this comment.
I reviewed all 14 changed files at 945fbdc463e6abc9b36ba9ea03de2581ce59081b (+317/−27), including provider selection, request preparation, direct and captured message encoding, codec identity, and the added Settings/model regressions. I found no confirmed P0–P2 issue in that scope.
The underlying failure is supported by the bundled catalog and executable controls: Ollama Cloud declares includeUsage: true and reasoning replay as reasoning, while the base execution gate rejects that combination. The revised gate accepts it and continues to reject the unimplemented reasoning-details and usage-normalization policies (providers/src/api/route.rs:48–75). The Settings path also explains the missing-choice symptom: model_choice drops models when provider metadata preparation fails (settings/native/src/service.rs:107–118).
The protocol premise has independent support. Ollama documents the cloud endpoint and stream_options.include_usage in its OpenAI compatibility documentation; its request implementation decodes reasoning and transfers it into the internal thinking field. This supports the selected wire field, but does not establish a successful authenticated cloud request.
I traced the selected adapter into the internal maka options, the usage switch in request preparation, and both message encoders. The default codec remains byte-identical, while the non-default reasoning field changes its identity (model/src/adapters/wire.rs:70–86), so the two captured encodings do not alias. No runtime protocol epoch or database schema changes are introduced.
Locally, the unmodified provider-protocol source passed its 20 existing tests in an isolated workspace with the repository's dependency versions. Thirteen additional checks passed using actual extracted gate/options/codec functions and the actual protocol library with controlled surrounding types. These cover catalog rejection/acceptance, explicit usage opt-out, unsupported-policy rejection, Unicode and tool-call replay, invalid field selection, default codec compatibility and absence of internal maka options from the request. Removing only the new reasoning-field remap made the replay check fail; restoring it passed. These are component checks, not a full model or Settings execution.
An actual merge into rust-preview at 74765152efe5e25dc38d6eb947f9b027127aed4c completed without conflicts. Current-head CI has passed tooling, root-build, product, packaging, bridge, native-ubuntu and all 22 root test partitions. I checked the raw logs for all seven added provider/model/Settings regressions, including the local HTTP reasoning/usage cases and the enabled Settings model-choice case: each passed.
The current macOS job has failed after successful compilation. Its desktop suite passes three cases, then desktop_creates_only_on_first_submission_and_preserves_the_confirmed_snapshot fails after 68.383s because the expected selected.png draft is absent (desktop_new_session.rs:265, observed: Null); 18 cases remain unrun due to fail-fast. The current base's macOS log, at the same 74765152 base, records the same case and draft failure after 67.967s, also leaving 18 cases unrun. The test file is identical between base and head. I have not established this PR as the cause of that failure. Windows job 128780933887 is still compiling, so the run has no final result and complete platform acceptance remains unconfirmed. I have not locally run the full model/Settings suites or an authenticated Ollama Cloud session; the HTTP fixture does not establish live cloud behavior.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
English
Summary
Problem
A model must pass execution preparation before Maka can offer it as a usable choice. Ollama Cloud declares streaming usage and assistant reasoning replay policies, but the compatibility gate treated those supported policies as unsupported. The Chat Completions executor also always requested streaming usage and encoded replayed reasoning as
reasoning_content, regardless of the provider contract.Impact
Enabled Ollama Cloud models could disappear from settings choices because preparation failed. Accepting the models alone would leave requests inconsistent with the provider: Ollama Cloud expects replayed reasoning in
reasoning, and providers that explicitly disable streaming usage need that choice to reach the outgoing request. Model availability and correct conversation replay therefore require the same policy to survive the entire preparation and encoding path.Fix
Accept the supported policies and carry them from provider resolution into request preparation. Honor explicit usage opt-out, and use the selected reasoning field in both direct message encoding and captured wire encoding used for replay. Distinguish non-default reasoning encodings in the codec identity while preserving the existing default identity, so captured messages remain compatible with the selected encoding.
Regression coverage exercises bundled Ollama Cloud model preparation, enabled settings choices, request/reply execution through a local HTTP fixture, usage opt-out propagation, both reasoning field encodings and the default codec identity.
Verification
At head
73fe03f7a, CI checksplan,toolingandnative-ubuntuhave passed (run). The remaining CI jobs are pending at this update; this is not a full-suite pass.The earlier local test totals are omitted because they do not establish results on this head. Full local
just check, an unpatched-base regression run and a live authenticated Ollama Cloud request are not verified for this head. The HTTP regression uses a local fixture; it does not establish live Ollama Cloud behavior.AI use
Tool(s) and scope: Codex (OpenAI) contributed to implementation, regression tests and PR preparation. All three contribution commits carry
Generated-by: Codex; preserve this trailer in the squash commit.Checklist
Regression tests are included, but an unpatched-base run and the full affected local suites are not verified for this head.
Does this PR entail a change in behavior?
中文
概述
问题
模型必须通过执行准备,Maka 才能将其作为可用选项展示。Ollama Cloud 声明了流式用量和助手推理回放策略,但兼容性检查将这些已支持的策略判定为不支持。此外,Chat Completions 执行器始终请求流式用量,并将回放的推理编码为
reasoning_content,没有使用提供方声明的协议约定。影响
执行准备失败会导致已启用的 Ollama Cloud 模型从设置选项中消失。仅放行模型仍会使请求与提供方要求不一致:Ollama Cloud 要求通过
reasoning回放推理,而明确禁用流式用量的提供方也需要将该选择传递到实际请求。因此,模型可用性和正确的对话回放都依赖同一策略贯穿执行准备与编码流程。修复方法
接受已支持的策略,并将其从提供方解析传递到请求准备。遵守显式禁用流式用量的配置,在直接消息编码和用于回放的已捕获消息编码中统一使用选定的推理字段。在编解码器标识中区分非默认推理编码,同时保留原有默认标识,确保已捕获消息与选定的编码方式兼容。
回归测试覆盖内置目录中的 Ollama Cloud 模型执行准备、已启用模型的设置选项、本地 HTTP 测试服务的请求与响应、禁用流式用量配置的传递、两种推理字段编码,以及默认编解码器标识。
验证
在当前提交
73fe03f7a上,CI 检查plan、tooling和native-ubuntu已通过(运行记录)。本次更新时其余 CI 任务尚未完成,不能据此声称全套检查通过。此前的本地测试数量已省略,因为它们不能证明当前提交的验证结果。当前提交尚未确认完整的本地
just check、未修复基线上的回归测试,以及经过身份验证的真实 Ollama Cloud 请求。HTTP 回归测试使用本地测试服务,不能证明真实 Ollama Cloud 的行为。AI 使用
工具及范围:Codex (OpenAI) 参与实现、回归测试和 PR 准备。三个贡献提交均包含
Generated-by: Codex;压缩合并时应保留该尾注。检查清单
已包含回归测试,但尚未确认当前提交在未修复基线上的测试结果,也未确认受影响的完整本地套件全部通过。
此 PR 是否改变行为?